***Turbull-Dugarte 2020 
*** Cross-pressures and the European lavender vote: Testing the conditionality of the sexuality gap***
***Replication file 1: Additional analysis usinf CHES coding of parties ***

use ESS_analysisfile.dta, clear


rename mnactic empstat
replace empstat=. if empstat>60

replace gincdif=. if gincdif>5
recode gincdif(1=5 "Agree Stongly")(2=4 "Agree")(3=3 "Neither agree/disagree")(4=2 "Disagree")(5=1 "Strongly disagree"), into(incdiff)
gen distribute=.
replace distribute=1 if incdiff>=4
replace distribute=0 if incdiff<4
gen incomenew=income1 if income2==.
replace incomenew=income2 if income2!=.
replace incomenew=. if incomenew>10






//Stepwise removal//


***VOTING CHOICE***


logit voteleft GL##c.incomenew gender age c.eduyrs religious i.domicil econview swd i.election if fulldata==1 & cntryID!=2 & partner==1 [pw=dweight], robust
margins GL, at(incomenew=(1(1)10)) post
marginsplot, l(90) xlabel(1(1)10) addplot(histogram incomenew if e(sample), discrete percent width(1) yaxis(2) yscale(alt) fcolor(%10) lc(black%30)) name(BEincome,replace) ti("without Belgium")

logit voteleft GL##c.incomenew gender age c.eduyrs religious i.domicil econview swd i.election if fulldata==1 & cntryID!=4 & partner==1 [pw=dweight],
margins GL, at(incomenew=(1(1)10)) post
marginsplot, l(90) xlabel(1(1)10) addplot(histogram incomenew if e(sample), discrete percent width(1) yaxis(2) yscale(alt) fcolor(%10) lc(black%30)) name(CHincome,replace) ti("without Switzerland")

logit voteleft GL##c.incomenew gender age c.eduyrs religious i.domicil econview swd i.election if fulldata==1 & cntryID!=7 & partner==1 [pw=dweight], robust
margins GL, at(incomenew=(1(1)10)) post
marginsplot, l(90) xlabel(1(1)10) addplot(histogram incomenew if e(sample), discrete percent width(1) yaxis(2) yscale(alt) fcolor(%10) lc(black%30)) name(DEincome,replace) ti("without Germany")

logit voteleft GL##c.incomenew gender age c.eduyrs religious i.domicil econview swd i.election if fulldata==1 & cntryID!=10 & partner==1 [pw=dweight], robust
margins GL, at(incomenew=(1(1)10)) post
marginsplot, l(90) xlabel(1(1)10) addplot(histogram incomenew if e(sample), discrete percent width(1) yaxis(2) yscale(alt) fcolor(%10) lc(black%30)) name(ESincome,replace) ti("without Spain")

logit voteleft GL##c.incomenew gender age c.eduyrs religious i.domicil econview swd i.election if fulldata==1 & cntryID!=11 & partner==1 [pw=dweight], robust
margins GL, at(incomenew=(1(1)10)) post
marginsplot, l(90) xlabel(1(1)10) addplot(histogram incomenew if e(sample), discrete percent width(1) yaxis(2) yscale(alt) fcolor(%10) lc(black%30)) name(FIincome,replace) ti("without Finland")

logit voteleft GL##c.incomenew gender age c.eduyrs religious i.domicil econview swd i.election if fulldata==1 & cntryID!=12 & partner==1 [pw=dweight], robust
margins GL, at(incomenew=(1(1)10)) post
marginsplot, l(90) xlabel(1(1)10) addplot(histogram incomenew if e(sample), discrete percent width(1) yaxis(2) yscale(alt) fcolor(%10) lc(black%30)) name(FRincome,replace) ti("without France")

logit voteleft GL##c.incomenew gender age c.eduyrs religious i.domicil econview swd i.election if fulldata==1 & cntryID!=13 & partner==1 [pw=dweight], robust
margins GL, at(incomenew=(1(1)10)) post
marginsplot, l(90) xlabel(1(1)10) addplot(histogram incomenew if e(sample), discrete percent width(1) yaxis(2) yscale(alt) fcolor(%10) lc(black%30)) name(GBincome,replace) ti("without Great Britain")

logit voteleft GL##c.incomenew gender age c.eduyrs religious i.domicil econview swd i.election if fulldata==1 & cntryID!=17 & partner==1 [pw=dweight], robust
margins GL, at(incomenew=(1(1)10)) post
marginsplot, l(90) xlabel(1(1)10) addplot(histogram incomenew if e(sample), discrete percent width(1) yaxis(2) yscale(alt) fcolor(%10) lc(black%30)) name(IEincome,replace) ti("without Ireland")

logit voteleft GL##c.incomenew gender age c.eduyrs religious i.domicil econview swd i.election if fulldata==1 & cntryID!=23 & partner==1 [pw=dweight], robust
margins GL, at(incomenew=(1(1)10)) post
marginsplot, l(90) xlabel(1(1)10) addplot(histogram incomenew if e(sample), discrete percent width(1) yaxis(2) yscale(alt) fcolor(%10) lc(black%30)) name(NLincome,replace) ti("without Netherlands")

logit voteleft GL##c.incomenew gender age c.eduyrs religious i.domicil econview swd i.election if fulldata==1 & cntryID!=24 & partner==1 [pw=dweight], robust
margins GL, at(incomenew=(1(1)10)) post
marginsplot, l(90) xlabel(1(1)10) addplot(histogram incomenew if e(sample), discrete percent width(1) yaxis(2) yscale(alt) fcolor(%10) lc(black%30)) name(NOincome,replace) ti("without Norway")

logit voteleft GL##c.incomenew gender age c.eduyrs religious i.domicil econview swd i.election if fulldata==1 & cntryID!=26 & partner==1 [pw=dweight], robust 
margins GL, at(incomenew=(1(1)10)) post
marginsplot, l(90) xlabel(1(1)10) addplot(histogram incomenew if e(sample), discrete percent width(1) yaxis(2) yscale(alt) fcolor(%10) lc(black%30)) name(PTincome,replace) ti("without Portugal")

logit voteleft GL##c.incomenew gender age c.eduyrs religious i.domicil econview swd i.election if fulldata==1 & cntryID!=28 & partner==1 [pw=dweight], robust
margins GL, at(incomenew=(1(1)10)) post
marginsplot, l(90) xlabel(1(1)10) addplot(histogram incomenew if e(sample), discrete percent width(1) yaxis(2) yscale(alt) fcolor(%10) lc(black%30)) name(SEincome,replace) ti("without Sweden")

grc1leg BEincome CHincome DEincome ESincome FIincome FRincome GBincome IEincome NLincome NOincome PTincome SEincome, leg(BEincome)

//education//

logit voteleft GL##c.eduyrs gender age c.incomenew religious i.domicil econview swd i.election if fulldata==1 & cntryID!=2 & partner==1 [pw=dweight], robust
margins GL, at(eduyrs=(1(1)25)) post
marginsplot, xlabel(1(1)25) addplot(histogram eduyrs if e(sample) & eduyrs<=25, discrete percent width(1) yaxis(2) yscale(alt) fcolor(%10) lc(black%30)) name(BEed,replace) ti("without Belgium")

logit voteleft GL##c.eduyrs gender age c.incomenew religious i.domicil econview swd i.election if fulldata==1 & cntryID!=4 & partner==1 [pw=dweight], robust
margins GL, at(eduyrs=(1(1)25)) post
marginsplot, xlabel(1(1)25) addplot(histogram eduyrs if e(sample) & eduyrs<=25, discrete percent width(1) yaxis(2) yscale(alt) fcolor(%10) lc(black%30)) name(CHed,replace) ti("without Switzerland")

logit voteleft GL##c.eduyrs gender age c.incomenew religious i.domicil econview swd i.election if fulldata==1 & cntryID!=7 & partner==1 [pw=dweight], robust
margins GL, at(eduyrs=(1(1)25)) post
marginsplot, xlabel(1(1)25) addplot(histogram eduyrs if e(sample) & eduyrs<=25, discrete percent width(1) yaxis(2) yscale(alt) fcolor(%10) lc(black%30)) name(DEed,replace) ti("without Germany")

logit voteleft GL##c.eduyrs gender age c.incomenew  religious i.domicil econview swd i.election if fulldata==1 & cntryID!=10 & partner==1 [pw=dweight], robust
margins GL, at(eduyrs=(1(1)25)) post
marginsplot, xlabel(1(1)25) addplot(histogram eduyrs if e(sample) & eduyrs<=25, discrete percent width(1) yaxis(2) yscale(alt) fcolor(%10) lc(black%30)) name(ESed,replace) ti("without Spain")

logit voteleft GL##c.eduyrs gender age c.incomenew  religious i.domicil econview swd i.election if fulldata==1 & cntryID!=11 & partner==1 [pw=dweight], robust
margins GL, at(eduyrs=(1(1)25)) post
marginsplot, xlabel(1(1)25) addplot(histogram eduyrs if e(sample) & eduyrs<=25, discrete percent width(1) yaxis(2) yscale(alt) fcolor(%10) lc(black%30)) name(FIed,replace) ti("without Finland")

logit voteleft GL##c.eduyrs gender age c.incomenew religious i.domicil econview swd i.election if fulldata==1 & cntryID!=12 & partner==1 [pw=dweight], robust
margins GL, at(eduyrs=(1(1)25)) post
marginsplot, xlabel(1(1)25) addplot(histogram eduyrs if e(sample) & eduyrs<=25, discrete percent width(1) yaxis(2) yscale(alt) fcolor(%10) lc(black%30)) name(FRed,replace) ti("without France")

logit voteleft GL##c.eduyrs gender age c.incomenew  religious i.domicil econview swd i.election if fulldata==1 & cntryID!=13 & partner==1 [pw=dweight], robust
margins GL, at(eduyrs=(1(1)25)) post
marginsplot, xlabel(1(1)25) addplot(histogram eduyrs if e(sample) & eduyrs<=25, discrete percent width(1) yaxis(2) yscale(alt) fcolor(%10) lc(black%30)) name(GBed,replace) ti("without Great Britain")

logit voteleft GL##c.eduyrs gender age c.incomenew religious i.domicil econview swd i.election if fulldata==1 & cntryID!=17 & partner==1 [pw=dweight], robust
margins GL, at(eduyrs=(1(1)25)) post
marginsplot, xlabel(1(1)25) addplot(histogram eduyrs if e(sample) & eduyrs<=25, discrete percent width(1) yaxis(2) yscale(alt) fcolor(%10) lc(black%30)) name(IEed,replace) ti("without Ireland")

logit voteleft GL##c.eduyrs gender age c.incomenew  religious i.domicil econview swd i.election if fulldata==1 & cntryID!=23 & partner==1 [pw=dweight], robust
margins GL, at(eduyrs=(1(1)25)) post
marginsplot, xlabel(1(1)25) addplot(histogram eduyrs if e(sample) & eduyrs<=25, discrete percent width(1) yaxis(2) yscale(alt) fcolor(%10) lc(black%30)) name(NLed,replace) ti("without Netherlands")

logit voteleft GL##c.eduyrs gender age c.incomenew  religious i.domicil econview swd i.election if fulldata==1 & cntryID!=24 & partner==1 [pw=dweight], robust
margins GL, at(eduyrs=(1(1)25)) post
marginsplot, xlabel(1(1)25) addplot(histogram eduyrs if e(sample) & eduyrs<=25, discrete percent width(1) yaxis(2) yscale(alt) fcolor(%10) lc(black%30)) name(NOed,replace) ti("without Norway")

logit voteleft GL##c.eduyrs gender age c.incomenew  religious i.domicil econview swd i.election if fulldata==1 & cntryID!=26 & partner==1 [pw=dweight], robust
margins GL, at(eduyrs=(1(1)25)) post
marginsplot, xlabel(1(1)25) addplot(histogram eduyrs if e(sample) & eduyrs<=25, discrete percent width(1) yaxis(2) yscale(alt) fcolor(%10) lc(black%30)) name(PTed,replace) ti("without Portugal")

logit voteleft GL##c.eduyrs gender age c.incomenew  religious i.domicil econview swd i.election if fulldata==1 & cntryID!=28 & partner==1 [pw=dweight], robust
margins GL, at(eduyrs=(1(1)25)) post
marginsplot, xlabel(1(1)25) addplot(histogram eduyrs if e(sample) & eduyrs<=25, discrete percent width(1) yaxis(2) yscale(alt) fcolor(%10) lc(black%30)) name(SEed,replace) ti("without Sweden")

grc1leg BEed CHed DEed ESed FIed FRed GBed IEed NLed NOed PTed SEed, leg(BEed)






//Including liberal in the left block//


gen chesdata=fulldata
replace chesdata=. if cntry=="NO"
replace chesdata=. if cntry=="CH"

gen votelib=0


***BELGIUM***

replace votelib=1 if prtvtbe==1 //gruen (Agalev)
replace votelib=1 if prtvtbe==3 //SP (Socialist Partiij)
replace votelib=1 if prtvtbe==5 //VLD (Opern Liberalen)
replace votelib=1 if prtvtbe==7 //PVDA
replace votelib=1 if prtvtbe==11 //ecolo
replace votelib=1 if prtvtbe==14  //Partitse socialisye

replace votelib=1 if prtvtabe==1 // Agalev/Gruen
replace votelib=1 if prtvtabe==5 //SP
replace votelib=1 if prtvtabe==8 //VLD
replace votelib=1 if prtvtabe==10 //Ecolo
replace votelib=1 if prtvtabe==12 //MR
replace votelib=1 if prtvtabe==13 //PS

replace votelib=1 if prtvtbbe==1 //Groen
replace votelib=1 if prtvtbbe==5 // SP
replace votelib=1 if prtvtbbe==8 // VLD
replace votelib=1 if prtvtbbe==10 // Ecolo
replace votelib=1 if prtvtbbe==12 // MR
replace votelib=1 if prtvtbbe==13 // PS

replace votelib=1 if prtvtcbe==1 //Groen
replace votelib=1 if prtvtcbe==5 //SP
replace votelib=1 if prtvtcbe==8 //VLD
replace votelib=1 if prtvtcbe==10 //Ecolo
replace votelib=1 if prtvtcbe==12 //MR
replace votelib=1 if prtvtcbe==13 //PS


**FINLAND***
replace votelib=1 if prtvtfi==2 // SPP swedish people's party
replace votelib=1 if prtvtfi==8 //Green League
replace votelib=1 if prtvtfi==9 // Soc Dems
replace votelib=1 if prtvtfi==10 // Left Alliance

replace votelib=1 if prtvtafi==2 //SPP 
replace votelib=1 if prtvtafi==7 //green league
replace votelib=1 if prtvtafi==8 // soc dems
replace votelib=1 if prtvtafi==9 //left alliance

replace votelib=1 if prtvtbfi==2 // SPP
replace votelib=1 if prtvtbfi==13 //green league
replace votelib=1 if prtvtbfi==14 //soc dems
replace votelib=1 if prtvtbfi==15 //left alliance


replace votelib=1 if prtvtcfi==2 //SPP
replace votelib=1 if prtvtcfi==12 //green league 
replace votelib=1 if prtvtcfi==13 // soc dems
replace votelib=1 if prtvtcfi==14 // left alliance

replace votelib=1 if prtvtdfi==2 //SPP
replace votelib=1 if prtvtdfi==10 //Green league
replace votelib=1 if prtvtdfi==11 // soc dems
replace votelib=1 if prtvtdfi==12 // left alliance

**FRANCE**

replace votelib=1 if prtvtfr==9 //Parti Communiste
replace votelib=1 if prtvtfr==10 //Parti Socialiste
replace votelib=1 if prtvtfr==14 //Los verts

replace votelib=1 if prtvtafr==9 //Parti Communiste
replace votelib=1 if prtvtafr==10 //Parti Socialiste
replace votelib=1 if prtvtafr==14 //The Greens


replace votelib=1 if prtvtbfr==7 //Parti Communiste
replace votelib=1 if prtvtbfr==8 //Parti Socialiste
replace votelib=1 if prtvtbfr==12 //The Greens 
replace votelib=1 if prtvtbfr==9 //Radical left party


replace votelib=1 if prtvtcfr==9 //Parti Socialiste
replace votelib=1 if prtvtcfr==12 //The Greens 
replace votelib=1 if prtvtcfr==7 //Radical left party
replace votelib=1 if prtvtcfr==6 //Left Front

***GERMANY***
replace votelib=1 if prtvde1==1 // SPD
replace votelib=1 if prtvde1==3 //Bundnis 90/Die Grunen
replace votelib=1 if prtvde1==4 //FDP
replace votelib=1 if prtvde1==5 // PDS

replace votelib=1 if prtvade1==1 // SPD
replace votelib=1 if prtvade1==3 //Bundnis 90/Die Grunen
replace votelib=1 if prtvade1==4 //FDP
replace votelib=1 if prtvade1==5 // PDS

replace votelib=1 if prtvbde1==1 // SPD
replace votelib=1 if prtvbde1==3 //Bundnis 90/Die Grunen
replace votelib=1 if prtvbde1==4 //FDP
replace votelib=1 if prtvbde1==5 // Die Linke/PDS

replace votelib=1 if prtvcde1==1 // SPD
replace votelib=1 if prtvcde1==3 //Bundnis 90/Die Grunen
replace votelib=1 if prtvcde1==4 //FDP
replace votelib=1 if prtvcde1==5 // Die Linke/ PDS

replace votelib=1 if prtvdde1==1 // SPD
replace votelib=1 if prtvdde1==3 //Bundnis 90/Die Grunen
replace votelib=1 if prtvdde1==4 //FDP
replace votelib=1 if prtvdde1==5 // Die Linke
replace votelib=1 if prtvdde1==8 //Piraten

replace votelib=1 if prtvede1==2 // SPD
replace votelib=1 if prtvede1==4 //Bundnis 90/Die Grunen
replace votelib=1 if prtvede1==3 // Die Linke
replace votelib=1 if prtvede1==5 // FDP
replace votelib=1 if prtvede1==7 // Piraten

***IRELAND***
replace votelib=1 if prtvtie==3 //Labour
replace votelib=1 if prtvtie==4 //Progressive Dems
replace votelib=1 if prtvtie==5 //Green Party

replace votelib=1 if prtvtaie==3 //Green Party
replace votelib=1 if prtvtaie==5 //Labour
replace votelib=1 if prtvtaie==6 // people  before profit
replace votelib=1 if prtvtaie==8 // socialist
replace votelib=1 if prtvtaie==9 // united left


replace votelib=1 if prtvtbie==1 //anti-austerity
replace votelib=1 if prtvtbie==4 // green party
replace votelib=1 if prtvtbie==6 //labour
replace votelib=1 if prtvtbie==8 //soc dems
replace votelib=1 if prtvtbie==9 //united left

***NETHERLANDS***

replace votelib=1 if prtvtnl==2 //Labour party
replace votelib=1 if prtvtnl==5 //Democrats 66
replace votelib=1 if prtvtnl==6 // Green left
replace votelib=1 if prtvtnl==7 //Socialist party

replace votelib=1 if prtvtanl==2 //Labour
replace votelib=1 if prtvtanl==5 //Democratic 66
replace votelib=1 if prtvtanl==6 //Green left
replace votelib=1 if prtvtanl==7 // Socialist party
replace votelib=1 if prtvtanl==11 // Party for animals


replace votelib=1 if prtvtbnl==2 //labour
replace votelib=1 if prtvtbnl==5 // democrats 66
replace votelib=1 if prtvtbnl==6 // green left
replace votelib=1 if prtvtbnl==7 // socialist party

replace votelib=1 if prtvtcnl==2 // labour party
replace votelib=1 if prtvtcnl==5 // democrats 66
replace votelib=1 if prtvtcnl==6 // green left
replace votelib=1 if prtvtcnl==7 // socialist party
replace votelib=1 if prtvtcnl==12 // animal party


replace votelib=1 if prtvtdnl==2 //labour 
replace votelib=1 if prtvtdnl==5 // socialist
replace votelib=1 if prtvtdnl==6 //democrats 66
replace votelib=1 if prtvtdnl==7 // green left
replace votelib=1 if prtvtdnl==10 // animal party


replace votelib=1 if prtvtenl==2 //labour
replace votelib=1 if prtvtenl==5 // socialist party
replace votelib=1 if prtvtenl==6 // democrats 66
replace votelib=1 if prtvtenl==7 // green left
replace votelib=1 if prtvtenl==10 // animal party
replace votelib=1 if prtvtenl==12 // 50plus


replace votelib=1 if prtvtfnl==2 //labour
replace votelib=1 if prtvtfnl==4 // socialist 
replace votelib=1 if prtvtfnl==6 // democrats 66
replace votelib=1 if prtvtfnl==8 // green left
replace votelib=1 if prtvtfnl==10 // animal party
replace votelib=1 if prtvtfnl==11 // 50plus



***PORTUGAL***

replace votelib=1 if prtvtpt==1 //Bloco de Esquerda (BE)
replace votelib=1 if prtvtpt==5 //PCP/PEV/CDU
replace votelib=1 if prtvtpt==8 //POUS
replace votelib=1 if prtvtpt==10 //Socialist


replace votelib=1 if prtvtapt==1 //BE
replace votelib=1 if prtvtapt==3 //CDU - PCP-PEV
replace votelib=1 if prtvtapt==9 // POUS
replace votelib=1 if prtvtapt==11 //Socialists

replace votelib=1 if prtvtbpt==1 // BE
replace votelib=1 if prtvtbpt==3 // CDU
replace votelib=1 if prtvtbpt==11 //PS

replace votelib=1 if prtvtcpt==2 //BE
replace votelib=1 if prtvtcpt==3 //CDU // PCP-PEP
replace votelib=1 if prtvtcpt==13 //PS 

**SPAIN
replace votelib=1 if prtvtes==2 //PSOE
replace votelib=1 if prtvtes==3 //IU
replace votelib=1 if prtvtes==5 //ERC
replace votelib=1 if prtvtes==6 //ICV
replace votelib=1 if prtvtes==8 //EA
replace votelib=1 if prtvtes==9 //BNG
replace votelib=1 if prtvtes==11 //PA
replace votelib=1 if prtvtes==12 //CHA


replace votelib=1 if prtvtaes==2 //PSOE
replace votelib=1 if prtvtaes==3 //IU
replace votelib=1 if prtvtaes==5 //ERC
replace votelib=1 if prtvtaes==6 //ICV
replace votelib=1 if prtvtaes==8 //EA
replace votelib=1 if prtvtaes==9 //BNG
replace votelib=1 if prtvtaes==11 //PA
replace votelib=1 if prtvtaes==12 //CHA


replace votelib=1 if prtvtbes==2 //PSOE
replace votelib=1 if prtvtbes==3 //IU
replace votelib=1 if prtvtbes==5 //ERC
replace votelib=1 if prtvtbes==7 //BNG
replace votelib=1 if prtvtbes==10 //UPyD


replace votelib=1 if prtvtces==2 //PSOE
replace votelib=1 if prtvtces==4 //IU
replace votelib=1 if prtvtces==5 //AMAIUR
replace votelib=1 if prtvtces==6 //UPyD
replace votelib=1 if prtvtces==8 //ERC
replace votelib=1 if prtvtces==9 //BNG


replace votelib=1 if prtvtdes==2 //PSOE
replace votelib=1 if prtvtdes==3 //unidos podemos
replace votelib=1 if prtvtdes==5 //Cs
replace votelib=1 if prtvtdes==7 //EnComunPodem
replace votelib=1 if prtvtdes==8 //compromis
replace votelib=1 if prtvtdes==10 //ERC

***SWEDEN***

replace votelib=1 if prtvtse==2 //Liberals (Folks partie)
replace votelib=1 if prtvtse==4 //Greens
replace votelib=1 if prtvtse==6 //Social Democrats
replace votelib=1 if prtvtse==7 //Left

replace votelib=1 if prtvtase==2 //Liberals
replace votelib=1 if prtvtase==4 //Greens
replace votelib=1 if prtvtase==6 //Social Democrats
replace votelib=1 if prtvtase==7 //Left
replace votelib=1 if prtvtase==8 //Feminist initiative

replace votelib=1 if prtvtbse==2 //Liberals
replace votelib=1 if prtvtbse==4 //Greens
replace votelib=1 if prtvtbse==6 //Social Democrats
replace votelib=1 if prtvtbse==7 //Left
replace votelib=1 if prtvtbse==8 //Feminist initiative
replace votelib=1 if prtvtbse==9 //Pirate party



***UK***
replace votelib=1 if prtvtgb==2 //Labour
replace votelib=1 if prtvtgb==3 //Lib dems
replace votelib=1 if prtvtgb==4 //SNP
replace votelib=1 if prtvtgb==5 //PLAID
replace votelib=1 if prtvtgb==6 //Greens

replace votelib=1 if prtvtagb==2 //Labour
replace votelib=1 if prtvtagb==3 //Lib dem
replace votelib=1 if prtvtagb==4 //SNP
replace votelib=1 if prtvtagb==5 //PLAID
replace votelib=1 if prtvtagb==6 //Greens

replace votelib=1 if prtvtbgb==2 //Labour
replace votelib=1 if prtvtbgb==3 //Lib dems
replace votelib=1 if prtvtbgb==4 //SNP
replace votelib=1 if prtvtbgb==5 //PLAID
replace votelib=1 if prtvtbgb==6 //Greens


**imcome
logit votelib GL##c.incomenew gender age c.eduyrs religious i.domicil econview swd i.cntryID i.year if chesdata==1 & partner==1 [pw=weight], robust cluster(cntry)
margins GL, at(incomenew=(1(1)10)) post
set scheme plotplain
marginsplot, xlabel(1(1)10) addplot(histogram incomenew if e(sample), discrete percent width(1) yaxis(2) yscale(alt) fcolor(%10) lc(black%30) ) name(liberal_income,replace)

**eduyears
logit votelib GL##c.eduyrs gender age c.incomenew religious i.domicil econview swd i.cntryID i.year if chesdata==1 & partner==1 [pw=weight], robust cluster(cntry)
margins GL, at(eduyrs=(1(1)25)) post
marginsplot, xlabel(1(1)25) addplot(histogram eduyrs if e(sample) & eduyrs<=25, discrete percent width(1) yaxis(2) yscale(alt) fcolor(%10) lc(black%30) ) name(liberal_ed,replace)

grc1leg liberal_income liberal_ed, leg(liberal_income) col(1)
